Inserting an image on a Web Page

Adding an image on a Web page helps you not only in making your website interactive but also in providing information with the help of graphics. Also adding an image on a Web page helps a user to understand the information more quickly and effectively. Besides adding a visual element that might attract the user to a particular part of the page, an image also helps in breaking the monotony of text on a Web page.

Let’s first learn how to insert an image on a Web page.

In HTML the <img> tag is used to insert images in Web pages. The <img> tag uses the src attribute, which takes an image file as a value. If your image is in the same folder where your HTML file is stored, then there is no need to specify the full path of the image file in the src attribute. However, if your image is in some other folder, then you must specify the full path of the image file in the src attribute of the <img> tag.

Let’s do the following steps to insert an image on a Web page:


<!DOCTYPE html>
<html>
<head>
    <title> Image </title>
</head>
<body>
    <h1>Inserting an Image in a Web Page</h1>
    <img src=”images\globe.jpg” /.>
</body>
</html>

Note: in the src attribute of the <img> tag, we have specified the path of the image (in our computer) that we are adding to our Web page. Similarly, you need to specify the path of the image (in our computer) that you want to add to your Web page. The image that you want to add to your Web page must reside in your computer.

Save the document with the name InsertingImage.html  and open other browser.